using System;
using System.Collections.Generic;
using System.Text;
using usm.SolDev.Common;
using usm.SolDev.DataBase.DataObjects;
using usm.SolDev.Common.Constants;

namespace usm.SolDev.DataBase
{
    public interface IDataProvider
    {

        /// <summary>
        ///     Test connection to database which is specidied by 
        /// connection string.
        /// </summary>
        /// <param name="connectionString"></param>
        void TestConnection(SQLConnectionString connectionString);

        /// <summary>
        ///     Load repository projects 
        /// </summary>
        /// <param name="userInfoData"></param>
        /// <returns></returns>
        List<ProjectDescriptor> LoadRepositoryContent(UserInfoData userInfoData);

        /// <summary>
        ///     Read user related info
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPassword"></param>
        /// <returns></returns>
        UserInfoData GetUserInfoData(string userName, string userPassword);

        /// <summary>
        ///     Save project to Database 
        /// </summary>
        /// <param name="userInfoData">full information about current user</param>
        /// <param name="project">project information</param>
        bool SaveProjectToRepository(ProjectDescriptor project);

        /// <summary>
        ///     Delete a project from Database 
        /// </summary>
        /// <param name="project">project related information</param>
        /// <returns>the ID of the deleted project, or null if operation has failed</returns>
        string DeleteProjectFromRepository(ProjectDescriptor project, UserInfoData userInfo);

        /// <summary>
        ///     Read all data required for user management from database. 
        /// </summary>
        /// <param name="currentUser">the current user whose rights are checked.</param>
        /// <returns>the structure which contains all information about user managment</returns>
        UserManagementData GetUserManagementData(UserInfoData currentUser);

        /// <summary>
        ///     Save user and group related modifications. This method actually calls 
        /// ManageGroup and ManageUsers methods with respective parameter
        /// </summary>
        /// <param name="currentUser">the current user who is requesting the operation</param>
        /// <param name="usersDataList">the list of users to be saved</param>
        /// <param name="groupDataList">the list of groups to be saved</param>
        /// <returns>the operation execution state</returns>
        object [] SaveUserManagementData(UserInfoData currentUser, List<UserInfoData> usersDataList, List<GroupDataObject> groupDataList);
/*
        /// <summary>
        ///     Manage group. Depending on object state, New, Modified or Deleted
        /// the group described by groupData parameter
        /// </summary>
        /// <param name="currentUser">the current user who is requesting the operation</param>
        /// <param name="groupData">the groups to save</param>
        /// <returns>a group data object. If the object is newly creted, the 
        /// id of the group is returned </returns>
        List<GroupDataObject> ManageGroup(UserInfoData currentUser, List<GroupDataObject> groupData);

        /// <summary>
        ///     Manage users. Depending on object state, New, Modified or Deleted
        /// the user described by items of the usersDataList parameter
        /// </summary>
        /// <param name="currentUser">the current user who is requesting the operation</param>
        /// <param name="usersDataList">a list of users which were modified or 
        /// created</param>
        /// <returns>the same user list</returns>
        List<UserInfoData> ManageUsers(UserInfoData currentUser, List<UserInfoData> usersDataList);
*/
    }
}
